/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CadastroFuncionario.java
 *
 * Created on 27/06/2012, 21:07:19
 */
package skyuff;

import Controle.Agencia;

/**
 *
 * @author Máctassio
 */
public class CadastroFuncionario extends javax.swing.JFrame {

    /** Creates new form CadastroFuncionario */
    public CadastroFuncionario() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        nomeLabel = new javax.swing.JLabel();
        nomeTextField = new javax.swing.JTextField();
        senhaLabel = new javax.swing.JLabel();
        senha = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        tipo = new javax.swing.JComboBox();
        salarioLabel = new javax.swing.JLabel();
        salario = new javax.swing.JTextField();
        cadastrofuncionarioLabel = new javax.swing.JLabel();
        cPFLabel = new javax.swing.JLabel();
        CPF = new javax.swing.JTextField();
        confirmaButton = new javax.swing.JButton();
        cancelaButton = new javax.swing.JButton();
        cadastravooButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(skyuff.SkyUFFApp.class).getContext().getResourceMap(CadastroFuncionario.class);
        nomeLabel.setText(resourceMap.getString("nomeLabel.text")); // NOI18N
        nomeLabel.setName("nomeLabel"); // NOI18N

        nomeTextField.setText(resourceMap.getString("nomeTextField.text")); // NOI18N
        nomeTextField.setName("nomeTextField"); // NOI18N
        nomeTextField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nomeTextFieldActionPerformed(evt);
            }
        });

        senhaLabel.setText(resourceMap.getString("senhaLabel.text")); // NOI18N
        senhaLabel.setName("senhaLabel"); // NOI18N

        senha.setText(resourceMap.getString("senha.text")); // NOI18N
        senha.setName("senha"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        tipo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Atendente", "Gerente", "Piloto", " " }));
        tipo.setName("tipo"); // NOI18N

        salarioLabel.setText(resourceMap.getString("salarioLabel.text")); // NOI18N
        salarioLabel.setName("salarioLabel"); // NOI18N

        salario.setText(resourceMap.getString("salario.text")); // NOI18N
        salario.setName("salario"); // NOI18N

        cadastrofuncionarioLabel.setText(resourceMap.getString("cadastrofuncionarioLabel.text")); // NOI18N
        cadastrofuncionarioLabel.setName("cadastrofuncionarioLabel"); // NOI18N

        cPFLabel.setText(resourceMap.getString("cPFLabel.text")); // NOI18N
        cPFLabel.setName("cPFLabel"); // NOI18N

        CPF.setText(resourceMap.getString("CPF.text")); // NOI18N
        CPF.setName("CPF"); // NOI18N

        confirmaButton.setText(resourceMap.getString("confirmaButton.text")); // NOI18N
        confirmaButton.setName("confirmaButton"); // NOI18N
        confirmaButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                confirmaButtonMouseClicked(evt);
            }
        });

        cancelaButton.setText(resourceMap.getString("cancelaButton.text")); // NOI18N
        cancelaButton.setName("cancelaButton"); // NOI18N
        cancelaButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                cancelaButtonMouseClicked(evt);
            }
        });

        cadastravooButton.setText(resourceMap.getString("cadastravooButton.text")); // NOI18N
        cadastravooButton.setName("cadastravooButton"); // NOI18N
        cadastravooButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                cadastravooButtonMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(salarioLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(salario, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(nomeLabel)
                                .addGap(10, 10, 10)
                                .addComponent(nomeTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(senhaLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(senha, javax.swing.GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(tipo, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 158, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(cPFLabel)
                                .addGap(18, 18, 18)
                                .addComponent(CPF, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cadastravooButton)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(cadastrofuncionarioLabel)
                        .addGap(136, 136, 136))))
            .addGroup(layout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addComponent(confirmaButton)
                .addGap(18, 18, 18)
                .addComponent(cancelaButton)
                .addContainerGap(205, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(cadastrofuncionarioLabel)
                .addGap(24, 24, 24)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nomeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(nomeLabel))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(senhaLabel)
                    .addComponent(senha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cPFLabel)
                    .addComponent(CPF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(22, 22, 22)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cadastravooButton)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel1)
                            .addComponent(tipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(salarioLabel)
                            .addComponent(salario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(confirmaButton)
                            .addComponent(cancelaButton))))
                .addContainerGap(34, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void nomeTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nomeTextFieldActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_nomeTextFieldActionPerformed

private void cancelaButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cancelaButtonMouseClicked
   this.dispose();
}//GEN-LAST:event_cancelaButtonMouseClicked

private void confirmaButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_confirmaButtonMouseClicked
   Agencia agencia = new Agencia();
   
   agencia.cadastroFuncionario(nomeTextField.getText(), CPF.getText(), senha.getText(), tipo.getSelectedIndex(),Double.parseDouble(salario.getText()));
   
   this.dispose();
}//GEN-LAST:event_confirmaButtonMouseClicked

private void cadastravooButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadastravooButtonMouseClicked
    CadastroVoo menu = new CadastroVoo();
    menu.setVisible(true);
}//GEN-LAST:event_cadastravooButtonMouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CadastroFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CadastroFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CadastroFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CadastroFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new CadastroFuncionario().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField CPF;
    private javax.swing.JLabel cPFLabel;
    private javax.swing.JButton cadastravooButton;
    private javax.swing.JLabel cadastrofuncionarioLabel;
    private javax.swing.JButton cancelaButton;
    private javax.swing.JButton confirmaButton;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel nomeLabel;
    private javax.swing.JTextField nomeTextField;
    private javax.swing.JTextField salario;
    private javax.swing.JLabel salarioLabel;
    private javax.swing.JTextField senha;
    private javax.swing.JLabel senhaLabel;
    private javax.swing.JComboBox tipo;
    // End of variables declaration//GEN-END:variables
}
